<?php
  require "./include/common.inc.php";
  $sql = "select c.`id`,c.`name`,c.`cover`,`ctime`,count(`sid`) sc from `course` c left join `achievement` a on a.`cid`=c.`id` where `tid` = $tid group by `cid`";
  $data = get_all($sql);
?>
<!DOCTYPE html>
<html>
<head>
	<title>课程列表</title>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<!-- loading mui -->
	<link rel="stylesheet" type="text/css" href="css/mui.min.css">
	<!-- custorm style -->
	<link rel="stylesheet" type="text/css" href="css/style.css">
</head>
<body>
	<!-- 导航栏 -->
	<header id="header" class="mui-bar mui-bar-nav">
		<h1 class="mui-title">奇猿学生课程管理系统</h1>
		<a class="mui-action-back mui-btn mui-btn-blue mui-btn-link mui-btn-nav mui-pull-left" href="javascript:history.go(-1)"><span class="mui-icon mui-icon-left-nav"></span></a>
		<a class="mui-icon mui-icon-bars mui-pull-right" href="#topPopover"></a>
	</header>
	<!-- 右上角弹出菜单 -->
	<div id="topPopover" class="mui-popover">
			<div class="mui-popover-arrow"></div>
			<div class="mui-scroll-wrapper">
				<div class="mui-scroll">
					<ul class="mui-table-view">
						<li class="mui-table-view-cell"><a href="teacher_index.php">首页</a>
						</li>
						<li class="mui-table-view-cell"><a href="query.html">我要查询</a>
						</li>
						<li class="mui-table-view-cell"><a href="vote.html">我要投票</a>
						</li>
						<li class="mui-table-view-cell"><a href="teacher_message.php">我要留言</a>
						</li>
						<li class="mui-table-view-cell"><a href="payment.html">我要缴费</a>
						</li>
						<li class="mui-table-view-cell"><a href="teacher_center.php">个人中心</a>
						</li>
					</ul>
				</div>
			</div>
		</div>
	</div>
	<!-- 主内容部分 -->
	<div class="content">
		<section class="xueqi">
			<div class="class">
				<label id="classResult">我的课程列表</label>
			</div>
		</section>
		<section class="rate_group">
			<table>
				<tr>
					<th>课程</th>
					<th>封面</th>
					<th>课时</th>
					<th>选修人数</th>
					<th>详情</th>
				</tr>
				<?php foreach($data as $item ){ ?>
				<tr>
					<td><?=$item['name']; ?></td>
					<td><img width="50" src="<?= WEB.$item['cover']; ?>"></td>
					<td><?=$item['ctime']; ?></td>
					<td><?=$item['sc']; ?></td>
					<td><a href="teacher_couse.php?cid=<?=$item['id']; ?>">查看</a></td>
				</tr>
				<?php } ?>
			</table>
	</div>
	<script src="js/mui.min.js"></script>
	<script src="js/img.js"></script>
</body>
</html>